<style lang="scss" scoped>
.button_to {
  text-align: center;
  padding: 30px;
}
.gdxx-div {
  outline: 1px dotted #cccccc;
  padding: 7px 0;
  margin-top: 7px;
  .repeat-div {
    border-bottom: 1px dotted #cccccc;
  }
  .cl-title {
    height: 36px;
    line-height: 36px;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
  }
  .form-label input {
    background-color: #ffffff !important;
    border: #ffffff !important;
    padding-left: 0px !important;
  }
  .gdxx-file {
    a {
      text-decoration: none;
      color: #308ee5;
      padding-right: 36px;
      font-size: 16px;
    }
    .file-btn {
      color: #308ee5;
      text-decoration: underline;
      padding: 0 4px;
      cursor: pointer;
      font-size: 16px;
    }
    .file-btn:hover {
      color: blue;
    }
  }
  .rmw-file-div {
    a {
      text-decoration: none;
      color: #308ee5;
      padding-right: 36px;
      font-size: 16px;
    }
    .file-btn {
      color: #308ee5;
      text-decoration: underline;
      padding: 0 4px;
      cursor: pointer;
      font-size: 16px;
    }
    .file-btn:hover {
      color: blue;
    }
  }
}
</style>

<template>
  <el-form
    :model="formItemData"
    ref="formItemData"
    label-width="100px"
    v-loading="loadingPage"
  >
    <!-- 公众信箱-公众工单 -->
    <div class="gdxx-div" v-if="showGzxxDiv">
      <div
        class="repeat-div"
        v-for="item in formItemData.gdInfoEntityList"
        :key="item.code"
      >
        <el-row>
          <el-col :span="10" :offset="1">
            <el-form-item label="工单编号：">
              <el-input
                size="small"
                :disabled="true"
                :value="item.code"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="来电(信)人：">
              <!-- <p size="small" disabled>{{item.income}}</p> -->
              <el-input
                size="small"
                :disabled="true"
                :value="item.income"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="10" :offset="1">
            <el-form-item label="联系人电话：">
              <!-- <p size="small" disabled>{{item.telphone}}</p> -->
              <el-input
                size="small"
                :disabled="true"
                :value="item.telphone"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="联系人邮箱：">
              <el-input
                size="small"
                :disabled="true"
                :value="item.email"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <el-row>
        <el-col :span="20" :offset="1">
          <el-form-item label="系统来源：">
            <el-input
              size="small"
              :disabled="true"
              :value="formItemData.sourceName"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="20" :offset="1">
          <el-form-item label="信件标题：">
            <el-input
              size="small"
              :disabled="true"
              :value="formItemData.gdInfoEntityList[0].title"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="20" :offset="1">
          <el-form-item label="信件内容：">
            <el-input
              type="textarea"
              autosize
              rows="99"
              size="small"
              :disabled="true"
              :value="formItemData.gdInfoEntityList[0].content"
              resize="none"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="20" :offset="1">
          <el-form-item label="转办说明：">
            <el-input
              type="textarea"
              autosize
              rows="99"
              size="small"
              :disabled="true"
              :value="formItemData.gdInfoEntityList[0].instruction"
              resize="none"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </div>

    <!-- 大联动-事件工单 -->
    <div class="gdxx-div" v-if="showDldDiv">
      <div
        class="repeat-div"
        v-for="item in formItemData.gdInfoEntityList"
        :key="item.code"
      >
        <el-row>
          <el-col :span="10" :offset="1">
            <el-form-item label="工单编号：">
              <el-input
                size="small"
                :disabled="true"
                :value="item.code"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="来电(信)人：">
              <!-- <p size="small" disabled>{{item.income}}</p> -->
              <el-input
                size="small"
                :disabled="true"
                :value="item.income"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="10" :offset="1">
            <el-form-item label="联系人电话：">
              <!-- <p size="small" disabled>{{item.telphone}}</p> -->
              <el-input
                size="small"
                :disabled="true"
                :value="item.telphone"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="联系人邮箱：">
              <el-input
                size="small"
                :disabled="true"
                :value="item.email"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <el-row>
        <el-col :span="20" :offset="1">
          <el-form-item label="系统来源：">
            <el-input
              size="small"
              :disabled="true"
              :value="formItemData.sourceName"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="20" :offset="1">
          <el-form-item label="内容：">
            <el-input
              type="textarea"
              autosize
              rows="99"
              size="small"
              :disabled="true"
              :value="formItemData.gdInfoEntityList[0].content"
              resize="none"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="20" :offset="1">
          <el-form-item label="办理要求：">
            <el-input
              type="textarea"
              autosize
              rows="99"
              size="small"
              :disabled="true"
              :value="formItemData.gdInfoEntityList[0].instruction"
              resize="none"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </div>

    <!-- 市长信箱-电话工单\信件工单\信箱工单 -->
    <div class="gdxx-div" v-if="showSzxxDiv">
      <div
        class="repeat-div"
        v-for="item in formItemData.gdInfoEntityList"
        :key="item.code"
      >
        <el-row>
          <el-col :span="10" :offset="1">
            <el-form-item label="工单编号：">
              <el-input
                size="small"
                :disabled="true"
                :value="item.code"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="来电(信)人：">
              <!-- <p size="small" disabled>{{item.income}}</p> -->
              <el-input
                size="small"
                :disabled="true"
                :value="item.income"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="10" :offset="1">
            <el-form-item label="联系人电话：">
              <!-- <p size="small" disabled>{{item.telphone}}</p> -->
              <el-input
                size="small"
                :disabled="true"
                :value="item.telphone"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="联系人邮箱：">
              <el-input
                size="small"
                :disabled="true"
                :value="item.email"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <el-row>
        <el-col :span="20" :offset="1">
          <el-form-item label="系统来源：">
            <el-input
              size="small"
              :disabled="true"
              :value="formItemData.sourceName"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="20" :offset="1">
          <el-form-item label="主题：">
            <el-input
              size="small"
              :disabled="true"
              :value="formItemData.gdInfoEntityList[0].title"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="20" :offset="1">
          <el-form-item label="内容：">
            <el-input
              type="textarea"
              autosize
              rows="99"
              size="small"
              :disabled="true"
              :value="formItemData.gdInfoEntityList[0].content"
              resize="none"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </div>

    <!-- 企业服务 -->
    <div class="gdxx-div" v-if="showQyffDiv">
      <div
        class="repeat-div"
        v-for="item in formItemData.gdInfoEntityList"
        :key="item.code"
      >
        <el-row>
          <el-col :span="10" :offset="1">
            <el-form-item label="工单编号：">
              <el-input
                size="small"
                :disabled="true"
                :value="item.code"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="来电(信)人：">
              <!-- <p size="small" disabled>{{item.income}}</p> -->
              <el-input
                size="small"
                :disabled="true"
                :value="item.income"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="10" :offset="1">
            <el-form-item label="联系人电话：">
              <!-- <p size="small" disabled>{{item.telphone}}</p> -->
              <el-input
                size="small"
                :disabled="true"
                :value="item.telphone"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="联系人邮箱：">
              <el-input
                size="small"
                :disabled="true"
                :value="item.email"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <el-row>
        <el-col :span="20" :offset="1">
          <el-form-item label="系统来源：">
            <el-input
              size="small"
              :disabled="true"
              :value="formItemData.sourceName"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="20" :offset="1">
          <el-form-item label="主题：">
            <el-input
              size="small"
              :disabled="true"
              :value="formItemData.gdInfoEntityList[0].title"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="20" :offset="1">
          <el-form-item label="内容：">
            <el-input
              type="textarea"
              autosize
              rows="99"
              size="small"
              :disabled="true"
              :value="formItemData.gdInfoEntityList[0].content"
              resize="none"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </div>

    <!-- 市人社局信箱 -->
    <div class="gdxx-div" v-if="showSrsjDiv">
      <div
        class="repeat-div"
        v-for="item in formItemData.gdInfoEntityList"
        :key="item.code"
      >
        <el-row>
          <el-col :span="10" :offset="1">
            <el-form-item label="工单编号：">
              <el-input
                size="small"
                :disabled="true"
                :value="item.code"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="来电(信)人：">
              <!-- <p size="small" disabled>{{item.income}}</p> -->
              <el-input
                size="small"
                :disabled="true"
                :value="item.income"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="10" :offset="1">
            <el-form-item label="联系人电话：">
              <!-- <p size="small" disabled>{{item.telphone}}</p> -->
              <el-input
                size="small"
                :disabled="true"
                :value="item.telphone"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="联系人邮箱：">
              <el-input
                size="small"
                :disabled="true"
                :value="item.email"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <el-row>
        <el-col :span="20" :offset="1">
          <el-form-item label="系统来源：">
            <el-input
              size="small"
              :disabled="true"
              :value="formItemData.sourceName"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="20" :offset="1">
          <el-form-item label="主题：">
            <el-input
              size="small"
              :disabled="true"
              :value="formItemData.gdInfoEntityList[0].title"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="20" :offset="1">
          <el-form-item label="内容：">
            <el-input
              type="textarea"
              autosize
              rows="99"
              size="small"
              :disabled="true"
              :value="formItemData.gdInfoEntityList[0].content"
              resize="none"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </div>

    <!-- 人民网信箱 -->
    <div class="gdxx-div" v-if="showRmwDiv">
      <div
        class="repeat-div"
        v-for="item in formItemData.gdInfoEntityList"
        :key="item.code"
      >
        <el-row>
          <el-col :span="10" :offset="1">
            <el-form-item label="工单编号：">
              <el-input
                size="small"
                :disabled="true"
                :value="item.code"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="来电(信)人：">
              <!-- <p size="small" disabled>{{item.income}}</p> -->
              <el-input
                size="small"
                :disabled="true"
                :value="item.income"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="10" :offset="1">
            <el-form-item label="联系人电话：">
              <!-- <p size="small" disabled>{{item.telphone}}</p> -->
              <el-input
                size="small"
                :disabled="true"
                :value="item.telphone"
              ></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="10">
            <el-form-item label="联系人邮箱：">
              <el-input
                size="small"
                :disabled="true"
                :value="item.email"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <el-row>
        <el-col :span="20" :offset="1">
          <el-form-item label="系统来源：">
            <el-input
              size="small"
              :disabled="true"
              :value="formItemData.sourceName"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="20" :offset="1">
          <el-form-item label="主题：">
            <el-input
              size="small"
              :disabled="true"
              :value="formItemData.gdInfoEntityList[0].title"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="20" :offset="1">
          <el-form-item label="内容：">
            <el-input
              type="textarea"
              autosize
              rows="99"
              size="small"
              :disabled="true"
              :value="formItemData.gdInfoEntityList[0].content"
              resize="none"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </div>

    <!-- 工单附件 -->
    <div class="gdxx-div" v-if="showFileDiv">
      <p class="cl-title">工单文件</p>
      <el-row class="gdxx-file">
        <el-col :span="20" :offset="1">
          <el-form-item label="文件：">
            <!-- formItemData.fileEntity.filePath -->
            <a href="javascript:void(0)">{{
              formItemData.fileEntity.fileName
            }}</a>
            <span class="file-btn" @click="filePreview">查看</span>
            <span class="file-btn" @click="fileDownload">下载</span>
          </el-form-item>
        </el-col>
      </el-row>
    </div>

    <!-- 流程信息 -->
    <div class="gdxx-div" v-if="showLcxxDiv">
      <p class="cl-title">处理流程</p>
      <el-row v-for="item in formItemData.gdHisEntityList" :key="item.wllzid">
        <el-col :span="20" :offset="1">
          <el-form-item label="流程：">
            <el-input
              type="textarea"
              autosize
              rows="99"
              size="small"
              :disabled="true"
              :value="
                '(' +
                  item.deptName +
                  ')' +
                  item.empName +
                  '在' +
                  item.replyTime +
                  ' ' +
                  item.replyState +
                  '：' +
                  item.replyDescription
              "
              resize="none"
            ></el-input>
            <!-- <p size="small">({{item.deptName}}){{item.empName}}  在  {{item.replyTime}}  {{item.replyState}}： {{item.replyDescription}}</p> -->
          </el-form-item>
        </el-col>
      </el-row>
    </div>

    <!-- 处理信息 -->
    <!-- <div class="gdxx-div"
         v-if="showClxxDiv">
      <p class="cl-title">处理信息</p>
      <el-row>
        <el-col :span="4"
                :offset="1">
          <el-form-item label="紧急件：">
            <el-switch active-color="red"
                       inactive-color="lightgray"
                       v-model="formItemData.isImportant_to"
                       disabled></el-switch>
          </el-form-item>
        </el-col>
        <el-col :span="6">
              <el-form-item label="不满意件：">
                <el-switch v-model="formItemData.isUnsatisfy" disabled></el-switch>
              </el-form-item>
            </el-col>
        <el-col :span="5">
          <el-form-item label="工单类别：">
            <el-input size="small"
                      :disabled="true"
                      :value="formItemData.cateName"></el-input>
            <el-radio-group v-model="formItemData.cateName">
                  <el-input class="form-label" v-model="formItemData.cateName" size="small" disabled></el-input>
                </el-radio-group>
          </el-form-item>
        </el-col>
        <el-col :span="5">
          <el-form-item label="执行处室：">
            <el-input size="small"
                      :disabled="true"
                      :value="formItemData.deptName"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="处理时限：">
            <el-input size="small"
                      :disabled="true"
                      :value="formItemData.limitTime"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="20"
                :offset="1">
          <el-form-item label="备注：">
            <el-input type="textarea"
                      autosize
                      rows="99"
                      size="small"
                      :disabled="true"
                      :value="formItemData.gdInfoEntityList[0].remark ? formItemData.gdInfoEntityList[0].remark : '无'"
                      resize="none"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </div> -->

    <div class="gdxx-div" v-if="showHfxxDiv">
      <p class="cl-title">回复信息</p>
      <div v-if="showThxxDiv">
        <el-row>
          <el-col :span="20" :offset="1">
            <el-form-item label="回复人/时间：">
              <el-input
                size="small"
                :disabled="true"
                :value="
                  formItemData.empName +
                    ' 在 ' +
                    formItemData.handleTime +
                    ' 退回'
                "
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="20" :offset="1">
            <el-form-item label="退回原因：">
              <el-input
                type="textarea"
                autosize
                rows="99"
                size="small"
                :disabled="true"
                :value="formItemData.handleDescription"
                resize="none"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </div>
      <div v-if="showBlxxDiv">
        <el-row>
          <el-col :span="20" :offset="1">
            <el-form-item label="回复人/时间：">
              <el-input
                size="small"
                :disabled="true"
                :value="
                  formItemData.empName +
                    ' 在 ' +
                    formItemData.handleTime +
                    ' 回复'
                "
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="20" :offset="1">
            <el-form-item label="回复内容：">
              <el-input
                type="textarea"
                autosize
                rows="99"
                size="small"
                :disabled="true"
                :value="formItemData.handleDescription"
                resize="none"
              ></el-input>
            </el-form-item>
          </el-col>
        </el-row>
        <div class="rmw-file-div" v-if="showRmwFileDiv">
          <el-row>
            <el-col :span="20" :offset="1">
              <el-form-item label="支撑材料：">
                <li>
                  <a href="javascript:void(0)">{{
                    formItemData.rmwFileEntity.fileName
                  }}</a>
                  <span class="file-btn" @click="rmwFilePreview">查看</span>
                  <span class="file-btn" @click="rmwFileDownload">下载</span>
                </li>
              </el-form-item>
            </el-col>
          </el-row>
        </div>
      </div>
    </div>

    <!-- 下发 -->
    <div class="gdxx-div">
      <p class="cl-title">处理信息</p>
      <el-row>
        <el-col :span="5" :offset="1">
          <el-form-item label="紧急件：">
            <el-switch
              active-color="red"
              inactive-color="lightgray"
              v-model="formItemData.isImportant"
            ></el-switch>
          </el-form-item>
        </el-col>
        <!--   <el-col :span="4">
              <el-form-item label="不满意件">
                <el-switch v-model="formItemData.isUnsatisfy"></el-switch>
              </el-form-item>
            </el-col>-->
        <el-col :span="12" :offset="1">
          <el-form-item label="处理时限：">
            <el-date-picker
              v-model="formItemData.limitTimeString"
              align="right"
              type="date"
              size="small"
              placeholder="选择日期"
              :picker-options="pickerOptions"
            ></el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="20" :offset="1">
          <el-form-item label="执行处室：">
            <el-checkbox-group v-model="formItemData.deptList">
              <el-checkbox
                v-for="item in deptCheckBoxList"
                :key="item.bmid"
                :label="item.bmjc"
                name="deptList"
              ></el-checkbox>
            </el-checkbox-group>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="20" :offset="1">
          <el-form-item label="工单类别：">
            <el-radio-group v-model="formItemData.cate">
              <el-radio
                v-for="item in cateGroupList"
                :key="item.catid"
                :disabled="lbDisabled"
                :label="item.name"
              ></el-radio>
            </el-radio-group>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="20" :offset="1">
          <el-form-item label="备注：" prop="remark">
            <el-input
              v-model="formItemData.remark"
              type="textarea"
              rows="2"
              resize="none"
              size="small"
            ></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </div>
    <div class="button_to">
      <el-button type="primary" @click="issueFn('formItemData')"
        >下发</el-button
      >
      <el-button type="" @click="backFn">返回</el-button>
    </div>
  </el-form>
</template>

<script>
export default {
  name: 'issued-detail',
  props: ['wllzid'],
  data () {
    return {
      loadingPage: false,
      // 日期规则
      pickerOptions: {
        disabledDate (time) {
          // return time.getTime() < Date.now()
        },
        shortcuts: [
          {
            text: '今天',
            onClick (picker) {
              picker.$emit('pick', new Date())
            }
          },
          {
            text: '两天后',
            onClick (picker) {
              const date = new Date()
              date.setTime(date.getTime() + 3600 * 1000 * 24 * 2)
              picker.$emit('pick', date)
            }
          },
          {
            text: '三天后',
            onClick (picker) {
              const date = new Date()
              date.setTime(date.getTime() + 3600 * 1000 * 24 * 3)
              picker.$emit('pick', date)
            }
          },
          {
            text: '一周后',
            onClick (picker) {
              const date = new Date()
              date.setTime(date.getTime() + 3600 * 1000 * 24 * 7)
              picker.$emit('pick', date)
            }
          }
        ]
      },
      deptCheckBoxList: [],
      // 表单数据
      formItemData: {
        cate: '',
        wllzid: '',
        limitTimeString: '',
        deptList: [],
        deptListNew: [],
        sourceName: '',
        isImportant_to: false,
        isImportant: false,
        isUnsatisfy: false,
        limitTime: '',
        deptName: '',
        cateName: '',
        fileEntity: {
          fileName: '',
          filePath: ''
        },
        gdHisEntityList: [
          {
            deptName: '',
            empName: '',
            replyState: '',
            replyTime: '',
            replyDescription: ''
          }
        ],
        gdInfoEntityList: [
          {
            code: '',
            income: '',
            telphone: '',
            email: '',
            infoid: '',
            remark: ''
          }
        ]
      },
      // div显示隐藏
      showGzxxDiv: false,
      showDldDiv: false,
      showSzxxDiv: false,
      showQyffDiv: false,
      showSrsjDiv: false,
      showRmwDiv: false,
      showFileDiv: false,
      showLcxxDiv: false,
      showClxxDiv: false,
      showHfxxDiv: false,
      showThxxDiv: false,
      showBlxxDiv: false,
      showRmwFileDiv: false,
      cateGroupList: [],
      lbDisabled: false
    }
  },
  created: function () {
    this.detailFn()
    this.getDeptCheckBoxList()
    // this.getCateGroupList()
  },
  methods: {
    backFn: function () {
      console.log('返回', this.$emit)
      this.$emit('fatherMethod')
    },
    // 下发
    issueFn: function () {
      const _this = this
      this.formItemData.handleTime = null
      // return

      if (
        _this.formItemData.limitTimeString === '' ||
        _this.formItemData.limitTimeString === null
      ) {
        _this.$message({
          message: '请选择处理时限...',
          showClose: true,
          type: 'warning'
        })
        return
      }
      if (_this.formItemData.deptList.length === 0) {
        _this.$message({
          message: '请选择执行处室...',
          showClose: true,
          type: 'warning'
        })
        return
      }
      if (
        _this.formItemData.cate.length === 0 ||
        _this.formItemData.cate === ''
      ) {
        _this.$message({
          message: '请选择工单类别...',
          showClose: true,
          type: 'warning'
        })
        return
      }
      // 执行处室
      let { deptCheckBoxList } = this
      let arr = _this.formItemData.deptList.map((item, index1) => {
        for (let index = 0; index < deptCheckBoxList.length; index++) {
          const element = deptCheckBoxList[index]
          if (item === element.bmjc) {
            return element.bmid
          }
        }
      })
      _this.formItemData.deptListNew = arr
      // 工单类别
      let { cateGroupList } = this
      let cateId = null
      for (let index = 0; index < cateGroupList.length; index++) {
        const element = cateGroupList[index]
        if (_this.formItemData.cate === element.name) {
          cateId = element.catid
          break
        }
      }
      _this.formItemData.cate = cateId
      // 拟办时限
      _this.formItemData.limitTime = _this.formItemData.limitTimeString
      // 发送请求
      // console.log(_this.formItemData)
      // 请求，解析内容

      this.$axios
        .post(_this.$api.service.issue, _this.formItemData)
        .then(rs => {
          if (rs) {
            _this.$message({
              message: '已成功下发...',
              showClose: true,
              type: 'success'
            })
            this.$emit('fatherMethod')
          } else {
            _this.loadingPaste = false
            _this.formItemData.deptList = []
            _this.formItemData.cate = ''
          }
        })
    },
    // 处室选择check-box
    getDeptCheckBoxList () {
      this.$axios.post(this.$api.dept.selector).then(rs => {
        if (rs) {
          console.log(rs)
          this.deptCheckBoxList = rs
        }
      })
    },
    // 工单类别选择group
    getCateGroupList () {
      this.$axios.post(this.$api.cate.work).then(rs => {
        if (rs) {
          this.cateGroupList = rs
        }
      })
    },
    // 获取数据源
    detailFn: function () {
      const _this = this
      // 请求，解析内容
      _this.loadingPage = true
      this.$axios
        .get(_this.$api.service.ToBeIssuedTo + '/' + _this.wllzid)
        .then(rs => {
          if (rs) {
            _this.formItemData = Object.assign(_this.formItemData, rs)
            this.formItemData.limitTimeString = _this.formItemData.limitTime
            _this.formItemData.limitTime = this.formatLimitDate(rs)
            _this.formItemData.handleTime = this.formatHandleDate(rs)

            // 判断工单文件
            if (rs.document === 1) {
              _this.showFileDiv = true
            }

            // 判断来源系统
            if (rs.sourceId == 12306) {
              _this.showSrsjDiv = true
            } else if (rs.sourceId == 12388) {
              _this.showRmwDiv = true
            } else if (rs.sourceId == 10086) {
              _this.showGzxxDiv = true
            } else if (rs.sourceId == 10010) {
              _this.showDldDiv = true
            } else if (rs.sourceId == 10000) {
              // 市长信箱
              _this.showSzxxDiv = true
              if (_this.formItemData.cate) {
                _this.lbDisabled = true
                _this.cateGroupList.forEach(item => {
                  if (_this.formItemData.cate == item.catid) {
                    _this.formItemData.cate = item.name
                  }
                })
              }
            } else if (rs.sourceId == 12580) {
              _this.showQyffDiv = true
            }

            // 流程信息
            if (rs.gdHisEntityList) {
              _this.showLcxxDiv = true
            }
            // 判断处理状态
            if (rs.handleState === 5) {
              _this.showThxxDiv = true
              _this.showHfxxDiv = true
            } else if (rs.handleState === 4) {
              _this.showBlxxDiv = true
              _this.showHfxxDiv = true
              // 人民网支撑材料
              if (rs.rmwFileEntity) {
                _this.showRmwFileDiv = true
              }
            }
            _this.showClxxDiv = true
            _this.loadingPage = false
          }
        })
    },
    // 格式化日期
    formatLimitDate: function (data) {
      const _this = this
      var date = data.limitTime
      if (date === undefined) {
        return ''
      }
      return _this.$moment(date).format('YYYY年MM月DD日')
    },
    formatHandleDate: function (data) {
      const _this = this
      var date = data.handleTime
      if (date === undefined) {
        return ''
      }
      return _this.$moment(date).format('YYYY年MM月DD日HH时mm分ss秒')
    },
    // 文件预览
    filePreview () {
      let fileUrl = this.formItemData.fileEntity.filePath
      this.$previewFile(fileUrl)
    },
    // 文件下载
    fileDownload () {
      let fileUrl = this.formItemData.fileEntity.filePath
      let fileName = this.formItemData.fileEntity.fileName
      this.$downloadFile(fileUrl, fileName)
    },
    // 文件预览
    rmwFilePreview () {
      let fileUrl = this.formItemData.rmwFileEntity.filePath
      this.$previewFile(fileUrl)
    },
    // 文件下载
    rmwFileDownload () {
      let fileUrl = this.formItemData.rmwFileEntity.filePath
      let fileName = this.formItemData.rmwFileEntity.fileName
      this.$downloadFile(fileUrl, fileName)
    }
  }
}
</script>
